/*--------------------------------------------------------------------------------*/
#ifndef __COMPONENT_ENTITY_2D__
#define __COMPONENT_ENTITY_2D__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include "math_vector_2.h"
#include "graphic_2d_animated_object.h"
#include "timer.h"
#include "color.h"
/*--------------------------------------------------------------------------------*/
class COMPONENT_ENTITY_2D : public OBJECT
{

	// -- PUBLIC

public:

    DECLARE_REF( COMPONENT_ENTITY_2D );

    // .. CONSTRUCTORS

    COMPONENT_ENTITY_2D() :
    	OBJECT(),
    	Position( MATH_VECTOR_2::Zero ),
    	Direction( MATH_VECTOR_2::Zero ),
    	Velocity( 0.0f ),
    	Angle( 0.0f ),
    	GraphicObject()
    {

    }

    virtual ~COMPONENT_ENTITY_2D()
    {
     
    }

    // .. METHODS

    VOID SetPosition( const MATH_VECTOR_2 & position )
    {
    	Position = position;
    }

    const MATH_VECTOR_2 & GetPosition() const
    {
		return Position;
    }

    VOID SetDirection( const MATH_VECTOR_2 & direction )
    {
    	Direction = direction;
    }

    const MATH_VECTOR_2 & GetDirection() const
    {
		return Direction;
    }

    VOID SetVelocity( const REAL velocity )
    {
    	Velocity = velocity;
    }

    const REAL & GetVelocity() const
    {
		return Velocity;
    }

    VOID SetExtent( const MATH_VECTOR_2 & extent )
    {
    	GraphicObject.SetExtent( extent );
    }

    const MATH_VECTOR_2 & GetExtent() const
    {
		return GraphicObject.GetExtent();
    }

    VOID SetAngle( const REAL angle )
    {
    	Angle = angle;
    }

    const REAL & GetAngle() const
    {
		return Angle;
    }
    
    VOID SetColor( const COLOR & color )
    {
    	GraphicObject.SetColor( color );
    }

    const COLOR & GetColor() const
    {
    	return GraphicObject.GetColor();
    }
    
    VOID Update( const TIMER & time_step );
    VOID Render();

    VOID PlayAnimation( const GRAPHIC_ANIMATION_DATA & animation );

    // -- PROTECTED

protected :

    // .. ATTRIBUTES

    MATH_VECTOR_2
		Position,
		Direction;
    REAL
		Velocity,
		Angle;
    GRAPHIC_2D_ANIMATED_OBJECT
		GraphicObject;
};
/*--------------------------------------------------------------------------------*/
#endif
